package com.bh.web.controller.statistics;

import com.bh.common.core.controller.BaseController;
import com.bh.statistics.service.IJcStatisticsService;
import com.bh.system.domain.SysNotice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/statistics")
public class JcOrderStatisticsController extends BaseController {

    @Autowired
    private IJcStatisticsService statisticsService;

    // 统计数据
    @GetMapping("/index")
    public Map<String, Object> statistics() {
        Map<String, Object> map = new HashMap<>();
        // 订单数
        map.put("orderCount", statisticsService.selectJcOrderCount());
        // 运单数
        map.put("shipmentCount", statisticsService.selectJcShipmentCount());
        // 网点数量
        map.put("orgCount", statisticsService.selectOrgCount());
        // 客户数
        map.put("customerCount", statisticsService.selectJcCustomerCount());
        // 本周订单数
        map.put("weekOrderCount", statisticsService.selectJcWeekOrderCount());
        // 本周运单数
        map.put("weekShipmentCount", statisticsService.selectJcWeekShipmentCount());
        // 前五名客户订单数
        map.put("topFiveCustomerOrderCount", statisticsService.selectTopFiveCustomerOrderCount());
        return map;
    }

    // 订单日历统计
    @GetMapping("/orderCalendar")
    public Map<String, Integer> orderCalendar() {
        return statisticsService.selectOrderCalendar();
    }

    // 查询消息通知列表
    @GetMapping("/notice")
    public List<SysNotice> notice() {
        return statisticsService.selectNotice();
    }
}
